Termination w.r.t. Q of the following Term Rewriting System could be proven:

Q restricted rewrite system:
The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

Q is empty.


QTRS
  ↳ Overlay + Local Confluence

Q restricted rewrite system:
The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

Q is empty.

The TRS is overlay and locally confluent. By [19] we can switch to innermost.

↳ QTRS
  ↳ Overlay + Local Confluence
QTRS
      ↳ DependencyPairsProof

Q restricted rewrite system:
The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))


Using Dependency Pairs [1,15] we result in the following initial DP problem:
Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
IF(true, s(X), s(Y)) → MINUS(X, Y)
IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))
MINUS(X, s(Y)) → MINUS(X, Y)
IF(false, s(X), s(Y)) → MINUS(Y, X)
LE(s(X), s(Y)) → LE(X, Y)
GCD(s(X), s(Y)) → LE(Y, X)
MINUS(X, s(Y)) → PRED(minus(X, Y))

The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
QDP
          ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
IF(true, s(X), s(Y)) → MINUS(X, Y)
IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))
MINUS(X, s(Y)) → MINUS(X, Y)
IF(false, s(X), s(Y)) → MINUS(Y, X)
LE(s(X), s(Y)) → LE(X, Y)
GCD(s(X), s(Y)) → LE(Y, X)
MINUS(X, s(Y)) → PRED(minus(X, Y))

The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 3 SCCs with 4 less nodes.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
QDP
                ↳ UsableRulesProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LE(s(X), s(Y)) → LE(X, Y)

The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LE(s(X), s(Y)) → LE(X, Y)

R is empty.
The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ QDP
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

LE(s(X), s(Y)) → LE(X, Y)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
QDP
                ↳ UsableRulesProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

MINUS(X, s(Y)) → MINUS(X, Y)

The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

MINUS(X, s(Y)) → MINUS(X, Y)

R is empty.
The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ QDP

Q DP problem:
The TRS P consists of the following rules:

MINUS(X, s(Y)) → MINUS(X, Y)

R is empty.
Q is empty.
We have to consider all minimal (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
QDP
                ↳ UsableRulesProof

Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))

The TRS R consists of the following rules:

minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X
le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
gcd(0, Y) → 0
gcd(s(X), 0) → s(X)
gcd(s(X), s(Y)) → if(le(Y, X), s(X), s(Y))
if(true, s(X), s(Y)) → gcd(minus(X, Y), s(Y))
if(false, s(X), s(Y)) → gcd(minus(Y, X), s(X))

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
As all Q-normal forms are R-normal forms we are in the innermost case. Hence, by the usable rules processor [15] we can delete all non-usable rules [17] from R.

↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
QDP
                    ↳ QReductionProof

Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))

The TRS R consists of the following rules:

le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)
gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))

We have to consider all minimal (P,Q,R)-chains.
We deleted the following terms from Q as each root-symbol of these terms does neither occur in P nor in R.

gcd(0, x0)
gcd(s(x0), 0)
gcd(s(x0), s(x1))
if(true, s(x0), s(x1))
if(false, s(x0), s(x1))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
QDP
                        ↳ QDPOrderProof

Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))

The TRS R consists of the following rules:

le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)

We have to consider all minimal (P,Q,R)-chains.
We use the reduction pair processor [15].


The following pairs can be oriented strictly and are deleted.


IF(true, s(X), s(Y)) → GCD(minus(X, Y), s(Y))
IF(false, s(X), s(Y)) → GCD(minus(Y, X), s(X))
The remaining pairs can at least be oriented weakly.

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))
Used ordering: Matrix interpretation [3]:
Non-tuple symbols:
M( minus(x1, x2) ) =
/0\
\0/
+
/11\
\01/
·x1+
/00\
\00/
·x2

M( le(x1, x2) ) =
/0\
\0/
+
/00\
\00/
·x1+
/00\
\00/
·x2

M( true ) =
/0\
\0/

M( pred(x1) ) =
/0\
\0/
+
/01\
\01/
·x1

M( false ) =
/0\
\0/

M( s(x1) ) =
/1\
\1/
+
/00\
\11/
·x1

M( 0 ) =
/0\
\0/

Tuple symbols:
M( GCD(x1, x2) ) = 1+
[0,1]
·x1+
[1,1]
·x2

M( IF(x1, ..., x3) ) = 1+
[0,0]
·x1+
[0,1]
·x2+
[1,1]
·x3


Matrix type:
We used a basic matrix type which is not further parametrizeable.


As matrix orders are CE-compatible, we used usable rules w.r.t. argument filtering in the order.
The following usable rules [17] were oriented:

minus(X, 0) → X
pred(s(X)) → X
minus(X, s(Y)) → pred(minus(X, Y))



↳ QTRS
  ↳ Overlay + Local Confluence
    ↳ QTRS
      ↳ DependencyPairsProof
        ↳ QDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ QDP
              ↳ QDP
              ↳ QDP
                ↳ UsableRulesProof
                  ↳ QDP
                    ↳ QReductionProof
                      ↳ QDP
                        ↳ QDPOrderProof
QDP
                            ↳ DependencyGraphProof

Q DP problem:
The TRS P consists of the following rules:

GCD(s(X), s(Y)) → IF(le(Y, X), s(X), s(Y))

The TRS R consists of the following rules:

le(s(X), s(Y)) → le(X, Y)
le(s(X), 0) → false
le(0, Y) → true
minus(X, s(Y)) → pred(minus(X, Y))
minus(X, 0) → X
pred(s(X)) → X

The set Q consists of the following terms:

minus(x0, s(x1))
minus(x0, 0)
pred(s(x0))
le(s(x0), s(x1))
le(s(x0), 0)
le(0, x0)

We have to consider all minimal (P,Q,R)-chains.
The approximation of the Dependency Graph [15,17,22] contains 0 SCCs with 1 less node.